package com.heima.wemedia.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.heima.wemedia.mapper.WmNewsMaterialMapper;
import com.heima.wemedia.pojo.WmNewsMaterial;
import com.heima.wemedia.service.WmNewsMaterialService;
import org.springframework.stereotype.Service;


/**
 * <p>
 * 自媒体图文引用素材信息表 服务实现类
 * </p>
 *
 * @author HM
 * @since 2023-03-22
 */
@Service
public class WmNewsMaterialServiceImpl extends ServiceImpl<WmNewsMaterialMapper, WmNewsMaterial> implements WmNewsMaterialService {
    /**
     * 根据文章id 删除中间表数据
     *
     * @param wmNewsId 文章id
     */
    @Override
    public void deleteByWmNewsId(Integer wmNewsId) {
        LambdaQueryWrapper<WmNewsMaterial> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(WmNewsMaterial::getNewsId, wmNewsId);
        this.remove(queryWrapper);
    }

}
